<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Demo05</title>
</head>
<body>
<h2>断网提醒测试</h2>
</body>
<script>
    window.addEventListener('online', () => {
        alert('芜湖, 我来了');
    });

    window.addEventListener('offline', () => {
        alert('西八, 我没了');
    });
</script>
</html>